/*****************************************************************************
*        描述 :
*             文件描述
*        CLR版本:            3.5
*        创建者 :            蒋 光
*        个人域名:           jiangguang.net.cn
*        命名空间名称:       ECP.Model
*        文件名:             BaseNoteEntity.cs
*        创建系统时间:       2012/11/2 19:07:03
*        创建年份:           2012
*
/*****************************************************************************/

namespace ECP.Model
{
    using System;
    using System.Data;
    using ECP.Utilities;

    [Serializable]
    public class BaseNoteEntity
    {
        private string categoryFullName;
        private string categoryID;
        private string color;
        private string content;
        private string createDate;
        private string createUserID;
        private bool deleteMark;
        private bool enabled;
        private string id;
        private bool important;
        private string modifyDate;
        private string modifyUserID;
        private string sortCode;
        private string title;

        public BaseNoteEntity()
        {
            this.id = string.Empty;
            this.title = string.Empty;
            this.categoryID = string.Empty;
            this.categoryFullName = string.Empty;
            this.color = string.Empty;
            this.content = string.Empty;
            this.enabled = true;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
        }

        public BaseNoteEntity(DataRow dataRow)
        {
            this.id = string.Empty;
            this.title = string.Empty;
            this.categoryID = string.Empty;
            this.categoryFullName = string.Empty;
            this.color = string.Empty;
            this.content = string.Empty;
            this.enabled = true;
            this.sortCode = string.Empty;
            this.createUserID = string.Empty;
            this.createDate = string.Empty;
            this.modifyUserID = string.Empty;
            this.modifyDate = string.Empty;
            this.GetFrom(dataRow);
        }

        public void ClearProperty()
        {
            this.ID = string.Empty;
            this.Title = string.Empty;
            this.CategoryID = string.Empty;
            this.CategoryFullName = string.Empty;
            this.Color = string.Empty;
            this.Content = string.Empty;
            this.Enabled = true;
            this.Important = false;
            this.DeleteMark = false;
            this.SortCode = string.Empty;
            this.CreateUserID = string.Empty;
            this.CreateDate = string.Empty;
            this.ModifyUserID = string.Empty;
            this.ModifyDate = string.Empty;
        }

        public BaseNoteEntity GetFrom(DataRow dataRow)
        {
            this.ID = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldID]);
            this.Title = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldTitle]);
            this.CategoryID = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldCategoryID]);
            this.CategoryFullName = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldCategoryFullName]);
            this.Color = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldColor]);
            this.Content = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldContent]);
            this.Enabled = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseNoteTable.FieldEnabled]);
            this.Important = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseNoteTable.FieldImportant]);
            this.DeleteMark = BaseBusinessLogic.ConvertIntToBoolean(dataRow[BaseNoteTable.FieldDeleteMark]);
            this.SortCode = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldSortCode]);
            this.CreateUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldCreateUserID]);
            this.CreateDate = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldCreateDate]);
            this.ModifyUserID = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldModifyUserID]);
            this.ModifyDate = BaseBusinessLogic.ConvertToString(dataRow[BaseNoteTable.FieldModifyDate]);
            return this;
        }

        public BaseNoteEntity GetFrom(DataTable dataTable)
        {
            foreach (DataRow row in dataTable.Rows)
            {
                this.GetFrom(row);
                break;
            }
            return this;
        }

        public string CategoryFullName
        {
            get
            {
                return this.categoryFullName;
            }
            set
            {
                this.categoryFullName = value;
            }
        }

        public string CategoryID
        {
            get
            {
                return this.categoryID;
            }
            set
            {
                this.categoryID = value;
            }
        }

        public string Color
        {
            get
            {
                return this.color;
            }
            set
            {
                this.color = value;
            }
        }

        public string Content
        {
            get
            {
                return this.content;
            }
            set
            {
                this.content = value;
            }
        }

        public string CreateDate
        {
            get
            {
                return this.createDate;
            }
            set
            {
                this.createDate = value;
            }
        }

        public string CreateUserID
        {
            get
            {
                return this.createUserID;
            }
            set
            {
                this.createUserID = value;
            }
        }

        public bool DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        public bool Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        public string ID
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        public bool Important
        {
            get
            {
                return this.important;
            }
            set
            {
                this.important = value;
            }
        }

        public string ModifyDate
        {
            get
            {
                return this.modifyDate;
            }
            set
            {
                this.modifyDate = value;
            }
        }

        public string ModifyUserID
        {
            get
            {
                return this.modifyUserID;
            }
            set
            {
                this.modifyUserID = value;
            }
        }

        public string SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        public string Title
        {
            get
            {
                return this.title;
            }
            set
            {
                this.title = value;
            }
        }
    }
}